package com.samsung.spen.sshare.networking.connection;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.samsung.spen.sshare.R;
import com.samsung.spen.sshare.networking.networkservice.SendReceiveService;
import com.samsung.spen.sshare.networking.sendreceivefile.SendReceiveActivity;

public class NetworkReceivedFileConfirmDialog_Activity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.network_activity_received_file_confirm_dialog);

		final String from = getIntent().getStringExtra(SendReceiveService.IP);
		final String from_port = getIntent().getStringExtra(SendReceiveService.PORT);
		final String data = getIntent().getStringExtra(SendReceiveService.DATALIST);

		TextView txt = (TextView) findViewById(R.id.txt_network_receive_file_confirm);
		String inform = from + txt.getText();
		txt.setText(inform);

		Button btnYess = (Button) findViewById(R.id.btn_network_receive_file_confirm_yes);
		btnYess.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent i = new Intent(
						NetworkReceivedFileConfirmDialog_Activity.this,
						SendReceiveActivity.class);
				i.putExtra(SendReceiveService.DATALIST, data);
				i.putExtra(SendReceiveService.IP, from);
				i.putExtra(SendReceiveService.PORT, from_port);
				startActivity(i);
				finish();
			}
		});
		
		Button btnNo = (Button)findViewById(R.id.btn_network_receive_file_confirm_no);
		btnNo.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}

}
